import serverRequest from "@/utils/server-request.ts";

export function listProblemsService(problemQueryForm:object) {
    return serverRequest({
        url: '/problem',
        method: 'GET',
        params: problemQueryForm
    })
}

export function saveProblemService(problemForm:object) {
    return serverRequest({
        url: '/problem',
        method: 'POST',
        data: problemForm
    })
}

export function updateProblemService(problemForm:object) {
    return serverRequest({
        url: '/problem',
        method: 'PUT',
        data: problemForm
    })
}

export function getProblemService(problemId:string) {
    return serverRequest({
        url: '/problem/' + problemId,
        method: 'GET'
    })
}

export function removeProblemApi(problemId:string) {
    return  serverRequest({
        url: '/problem/' + problemId,
        method: 'DELETE'
    })
}

export function publishProblemAPi(problemId:string) {
    return serverRequest({
        url: '/problem/publish/' + problemId,
        method: 'PUT'
    })
}

export function cancelProblemApi(problemId:string) {
    return serverRequest({
        url: '/problem/cancel/' + problemId,
        method: 'PUT'
    })
}